package com.sc.server.system.common.bean;

import lombok.Data;

import java.io.Serializable;
@Data
public class BaseResponseDto<T>  implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = -600973566825725443L;

    private T data;
    //200正确，400：token过期，500正常错误，505系统错误
    private int status = 200;
    private String message = "Success";
    private String errorMsg = "fail";

    public BaseResponseDto(T data, int status, String message, String errorMsg) {
        this.data = data;
        this.status = status;
        this.message = message;
        this.errorMsg = errorMsg;
    }

    public BaseResponseDto() {
    }

    public static BaseResponseDto error(Object data) {
        return new BaseResponseDto(data, 500, "fail", "fail");

    }

    public BaseResponseDto(T data) {
        this.data = data;
    }

    public static BaseResponseDto ok(Object data) {
        return new BaseResponseDto(data);


    }
}